home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
T
/
TC Prog Guide.cpt
/
picture ƒ
/
anring.c
< prev
next >
Wrap
Text File
|
1990-11-09
|
2KB
|
72 lines
/*
* FILE: anring.c
* AUTHOR: R. Gonzalez
* CREATED: November 8, 1990
*
* defines methods for ring animated segment
*/
# include "anring.h"
# include "trans.h"
# include "atring.h"
# define NUM_SATELLITES 2
# define RADIUS 3.
# define SATELLITE_TYPE Atomic_Ring
# define ANIMATED_SATELLITES TRUE
# define ANGULAR_VELOCITY PI/20.
/******************************************************************
* initialize
******************************************************************/
boolean Animated_Ring::init(void)
{
int i;
Translation *transl;
Rotation_Y *roty;
Transformation *combination;
/* The following temps are needed due to a bug in Think C when
handling arrays of pointers, when the array is an instance var.
*/
Segment *temp_seg;
Transformation *temp_trans;
Animated_Segment::init();
transl = new(Translation);
transl->init();
transl->set(0.,0.,RADIUS);
roty = new(Rotation_Y);
roty->init();
combination = new(Transformation);
combination->init();
num_segments = NUM_SATELLITES;
for (i=0 ; i<NUM_SATELLITES ; i++)
{
temp_seg = new(SATELLITE_TYPE);
segment[i] = temp_seg;
segment[i]->init();
roty->set(i*2.*PI/NUM_SATELLITES);
combination->combine(transl,roty);
segment[i]->move(combination);
temp_trans = new(Rotation_Y);
animation[i] = temp_trans;
animation[i]->init();
((Rotation_Y*) animation[i])->set(ANGULAR_VELOCITY);
if (ANIMATED_SATELLITES)
log_animated_segment(segment[i]);
}
transl->destroy();
delete(transl);
roty->destroy();
delete(roty);
combination->destroy();
delete(combination);
return TRUE;
}